package com.cyys.controller;

import com.cyys.entity.Store;
import com.cyys.response.Result;
import com.cyys.service.StoreService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @ClassName StoreController
 * @Description: TODO
 * @Author 86152
 * @Date 2022/5/27
 * @Version V1.0
 **/
@RestController
@RequestMapping("/store")
public class StoreController {

    @Autowired
    private StoreService storeService;

    @GetMapping("/store_page")
    public Result findStore(){
        List<Store> list = storeService.list();
         return Result.ok().data("list",list);
    }

    @GetMapping("/store_page/name")
    public Result findStoreByName(String name){
        List<Store> stores = storeService.selectStoreByName(name);
        return Result.ok().data("list",stores);
    }

    /**
     * 状态0的店铺查询
     * @return
     */
    @GetMapping("/selectPages")
    public Result selectPages(){
        List<Store> stores = storeService.selectPages();
        return Result.ok().data("list",stores);
    }






}
